public class Test {
    public int firstUniqChar(String s){
        int []count =new int[26];
        for (int i = 0; i <=s.length(); i++) {//遍历字符串
            char ch=s.charAt(i);//拿到s字符串的每一个字符
            count[ch-'a']++;//对应的位置加一
        }
        //已经统计好了  再次遍历字符串
        for (int i = 0; i <=s.length(); i++) {//遍历字符串
            char ch = s.charAt(i);//拿到s字符串的每一个字符
            if (count[ch - 'a'] == 1) {
                return i;//找到了，返回下标
            }
        }
            return -1;
    }
    public static void main(String[] args) {

    }
    public static void main1(String[] args) {
        StringBuilder stringBuilder=new StringBuilder("abcd");
        stringBuilder.append("yyyyyyy");
        System.out.println(stringBuilder);
    }
}
